/************************************************************************

								Heroes IV
					  Copyright 2000, The 3DO Company

	------------------------------------------------------------------
  						 artifact_prop_spell_cost.h

	$Header: /heroes4/artifact_prop_spell_cost.h $

	$NoKeywords: $

 ************************************************************************/

#if !defined( ARTIFACT_PROP_SPELL_COST_H_INCLUDED )
#define ARTIFACT_PROP_SPELL_COST_H_INCLUDED

#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000

#include "artifact_prop_spell_list.h"

namespace t_artifact_prop
{
	// ----------------------------------------------------------------------
	// class for effects which change spell costs
	// ----------------------------------------------------------------------
	class t_spell_cost_base : public t_spell_list_effect
	{
	public:
		void init( t_artifact_target target, int amount, int percentage );

		virtual bool accept( t_artifact_effect_visitor& visitor );
		int			 get_percentage() const;
		virtual bool read( std::streambuf& buffer );
		void         set_percentage( int arg );
		virtual bool write( std::streambuf& buffer ) const;
	protected:
		int m_percentage; // and/or a percentage change
	};

	inline void t_spell_cost_base::init( t_artifact_target target, int amount, int percentage )
	{
		t_spell_list_effect::init( target, amount );
		m_percentage = percentage;
	}

	inline int t_spell_cost_base::get_percentage() const
	{
		return m_percentage;
	}

	inline void t_spell_cost_base::set_percentage( int arg )
	{
		m_percentage = arg;
	}

	typedef t_effect< t_spell_cost_base, k_artifact_effect_spell_cost > t_spell_cost;

};

#endif // ARTIFACT_PROP_SPELL_COST_H_INCLUDED